<%@page contentType="text/html; charset=UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<%@ include file="../common/common.jsp"%>
		<script type="text/javascript">
			$(function(){
				var editRow = undefined;
				$("#staff_past_experience").datagrid({
					title : '',
					height : 140,
					fitColumns : true,
					pagination : false,
					rownumbers : true,
					loadMsg : '',
					pageSize : 4,
					url : "",
					columns : [[
					    {field : 'org',title : '部门',width : 200,
							editor: {                             
								type: 'validatebox',                             
								options: {                                 
									//required: true,                          
									missingMessage: '请输入部门'                            
								}
							}
						},
						{field : 'time',title : '工作时间',width : 200,
							editor: {                             
								type: 'validatebox',                             
								options: {                                 
									//required: true,                          
									missingMessage: '请工作时间'                            
								}
							}
						},
						{field : 'a',title : '职务',width : 200,
							editor: {                             
								type: 'validatebox',                             
								options: {                                 
									//required: true,                          
									missingMessage: '请输入职务'                            
								}
							}
						}
					]],
				    onBeforeEdit:function(index,row){
				        row.editing = true;
				        $('#staff_past_experience').datagrid('refreshRow', index);
				    },
				    onAfterEdit:function(index,row){
				        row.editing = false;
				        $('#staff_past_experience').datagrid('refreshRow', index);
				        editRow = undefined;
				    },
				    onCancelEdit:function(index,row){
				        row.editing = false;
				        $('#staff_past_experience').datagrid('refreshRow', index);
				    },
				    toolbar:[{
			            text: '添加',
			            iconCls: 'icon-add',
			            handler: function () {
			                if (editRow != undefined) {
			                    $("#staff_past_experience").datagrid('endEdit', editRow);
			                }
			                if (editRow == undefined) {
			                    $("#staff_past_experience").datagrid('insertRow', {
			                        index: 0,   // index start with 0
			                        row: {
			                        }
			                    });
			                    $("#staff_past_experience").datagrid('beginEdit', 0);
			                    editRow = 0;
			                }
			            }
			        },'-', {
			            text: '修改',
			            iconCls: 'icon-edit',
			            handler:function () {
			                var rows = $("#staff_past_experience").datagrid('getSelections');
			                if(rows.length==1) {
			                    if (editRow != undefined) {
			                        $("#staff_past_experience").datagrid('endEdit', editRow);
			                    }
			                    if (editRow == undefined) {
			                        var index = $("#staff_past_experience").datagrid('getRowIndex',rows[0]);
			                        $("#staff_past_experience").datagrid('beginEdit', index);
			                        editRow = index;
			                        //$("#staff_education_info").datagrid('unselectAll');
			                    }
			                }
			            }
			        },'-', {
			            text: '删除',
			            iconCls: 'icon-remove',
			            handler:function () {
			                var rows = $("#staff_past_experience").datagrid('getSelections');
			                if (rows.length > 0) {
			                     $.messager.confirm('请确认', '您确定要删除当前所有选择的项目吗?', function(b) {
			                        if(b) {
			                            for (var i = 0; i < rows.length; i++) {
			                                var rowIndex = $("#staff_past_experience").datagrid('getRowIndex', rows[i]);
			                                $("#staff_past_experience").datagrid('deleteRow', rowIndex);
			                            }
			                        }
			                    });
			                } else {
			                    $.messager.alert('提示', '请选择要删除的记录', 'error');
			                }
			            }
			        },'-', {
			            text: '完成编辑',
			            iconCls: 'icon-save',
			            handler:function () {
			                $("#staff_past_experience").datagrid('endEdit', editRow);
			            }
			        },'-'/* , {
			            text: '取消编辑',
			            iconCls: 'icon-redo',
			            handler:function () {
			                editRow = undefined; 
			                $("#staff_education_info").datagrid('rejectChanges');
			                $("#staff_education_info").datagrid('unselectAll');
			            }
			        }, '-' */],   
			        onDblClickRow: function (rowIndex, rowData) {
			            if (editRow != undefined) {
			                $("#staff_past_experience").datagrid('endEdit', editRow);
			            }
			            if (editRow == undefined) {
			                $("#staff_past_experience").datagrid('beginEdit', rowIndex);
			                editRow = rowIndex;
			            }

			        }
				});
			});
		</script>
	</head>
	<body class = "easyui-layout">
		<div>
			<form action="">
				<table class="MsoNormalTable"style = "border:2px solid #b3dfda;width:840px" >
					<tr>
						<td>
							<div  class="fitem">
								<span>申请日期:</span>
								<input name = "" class = "easyui-datebox" required = "true">
							</div>
						</td>
					</tr>
					<tr>
						<td>
							<div  class="fitem">
								<span>员工姓名:</span>
								<input name = "" class = "easyui-validatebox" required = "true" readOnly = "true">
							</div>
						</td>
						<td>
							<div  class="fitem">
								<span>所属部门:</span>
								<input name = "" class = "easyui-validatebox" required = "true" readOnly = "true">
							</div>
						</td>
					</tr>
					<tr>
						<td>
							<div  class="fitem">
								<span>原职级:</span>
								<input name = "" class = "easyui-validatebox" required = "true" readOnly = "true">
							</div>
						</td>
						<td>
							<div  class="fitem">
								<span>新职级:&nbsp;&nbsp;</span>
								<input name = "" class = "easyui-validatebox" required = "true" readOnly = "true">
							</div>
						</td>
					</tr>
					<tr>
						<td>
							<div  class="fitem">
								<span>原岗位工资:</span>
								<input name = "" class = "easyui-validatebox" required = "true" readOnly = "true">
							</div>
						</td>
						<td>
							<div  class="fitem">
								<span>新岗位工资:</span>
								<input name = "" class = "easyui-validatebox" required = "true" readOnly = "true">
							</div>
						</td>
					</tr>
					<tr>
						<td>
							<div  class="fitem">
								<span>建议晋升开始时间:</span>
								<input name = "" class = "easyui-datebox" required = "true">
							</div>
						</td>
					</tr>
				</table>
				<table class="MsoNormalTable"style = "border:2px solid #b3dfda;width:840px" >
					<tr>
						<th><label>个人资料</label></th>
					</tr>
					<tr>
						<td>
							<div class = "fitem">
								<span>年龄:</span>
								<input name = "" class = "easyui-validatebox" required = "true">
							</div>
						</td>
						<td>
							<div class = "fitem">
								<span>出生日期:</span>
								<input name = "" class = "easyui-datebox" required = "true">
							</div>
						</td>
					</tr>
					<tr>
						<td>
							<div class = "fitem">
								<span>学历:</span>
								<input name = "" class = "easyui-validatebox" required = "true">
							</div>
						</td>
					</tr>
					<tr>
						<td>
							<div class = "fitem">
								<span>外部年限:</span>
								<input name = "" class = "easyui-validatebox" required = "true">
							</div>
						</td>
						<td>
							<div class = "fitem">
								<span>内部年限:</span>
								<input name = "" class = "easyui-validatebox" required = "true">
							</div>
						</td>
					</tr>
					<tr>
						<td>
							<div class = "fitem">
								<span>合计:</span>
								<input name = "" class = "easyui-validatebox" required = "true">
							</div>
						</td>
					</tr>
				</table>
				<table class="MsoNormalTable"style = "border:2px solid #b3dfda;width:840px" >
					<tr>
						<th><label>公司经历</label></th>
					</tr>
					<tr>
						<td>
							<span>入职日期</span>
							<input name = "" class = "easyui-datebox" required = "true">
						</td>
					</tr>
				</table>
				<table id = "staff_past_experience" class = "easyui-datagrid" style = "border:2px solid #b3dfda;width : 840px" align = "left">
				</table>
				<div class = "fitem">
					<span>晋升说明：</span>
					<textarea name = "" class = "easyui-textarea" required = "true" style = "width : 800px;heigth : 300px;" ></textarea>
				</div>
				<div class = "fitem">
					<span>人力资源部初审：</span>
					<textarea name = "" class = "easyui-textarea" required = "true" style = "width : 800px;heigth : 300px;" ></textarea>
				</div>
				<div class = "fitem">
					<span>部门经理意见：</span>
					<textarea name = "" class = "easyui-textarea" required = "true" style = "width : 800px;heigth : 300px;" ></textarea>
				</div>
				<div class = "fitem">
					<span>总经理意见：</span>
					<textarea name = "" class = "easyui-textarea" required = "true" style = "width : 800px;heigth : 300px;" ></textarea>
				</div>
				<div id="dlg-buttons" region = "south" style="text-align:center;margin-top:50px;padding:5px 0;">
					<a href="#" class="easyui-linkbutton" iconCls="icon-ok"
						onclick="saveCp_info()">保存</a>
					<a href="#" class="easyui-linkbutton" iconCls="icon-cancel"
						onclick="javascript:$('#promote_info_win').window('close')">取消</a>
				</div>
			</form>
		</div>
	</body>
</html>
